<template>
    <a-modal v-model:visible="visible" title="Basic Modal" destroyOnClose :afterClose="unmountInstance">
      <p>Some contents...</p>
      <p>Some contents...</p>
      <p>Some contents...</p>
      <a-button @click="doClick">弹框内部按钮</a-button>
      <h1>现在时间是 {{ time }}</h1>
      <h1 v-for="(item, index) in list" :key="index">{{ item }}</h1>
    </a-modal>
</template>

<script>
import { ref, reactive } from 'vue'
import test from './test'
export default {
  props: {
    unmountInstance: {
      type: Function,
      default: () => {}
    },
    time: {
      type: [String, Number],
      default: ''
    },
    fn:{
      type: Function,
      default: () => {}
    }
  },
  setup({fn}) {

    const visible = ref(true)

    const list = reactive([1,2,3,4])

    const doti = () => {
      console.log('点击了 doit')
    }

    const doClick = () => {
      const instance =  $g.createInstance(test, {
        time: new Date().getTime(),
        fn(){
          console.log('fn 执行了 ++++++++++++++++++++++++++++++++++')
          console.log(instance.instanceRef)
        }
      })
    }

    // 执行 fn
    // fn()

    return {
      visible,
      list,
      doClick
    }
  }
}
</script>
